{{Use dmy dates|date=September 2013}}
{{refimprove|date=December 2013}}

File:Crashed computer.jpg|thumb|A crashed iMac

In computing, a '''crash''' (or '''system crash''') occurs when a computer program, such as a software application or an operating system, stops functioning properly and exit (system call)|exits. The program responsible may appear to hang (computing)|hang until a crash reporter|crash reporting service reports the crash and any details relating to it. If the program is a critical part of the operating system, the entire system may crash or hang
(computing)|hang, often resulting in a kernel panic or fatal system error.

Most crashes are the result of executing invalid Instruction set|machine instructions. Typical causes include incorrect address space|address values in the program counter, buffer overflow, overwriting a portion of the affected program code due to an earlier Computer bug|bug, accessing invalid memory addresses, using an illegal opcode or triggering an unhandled Exception handling|exception. The original software bug that started this chain of events is
typically considered to be the cause of the crash, which is discovered through the process of debugging. The original bug can be far removed from the source code|code that actually crashed.

In earlier personal computers, attempting to write data to hardware addresses outside of the system's main memory could cause hardware damage. Some crashes are Exploit (computer security)|exploitable and allow a malicious program or hacker to execute arbitrary code execution|arbitrary code allowing for the replication of computer virus|viruses or the acquisition of data which would normally be inaccessible.

Application crashes
Image:Computer crash airport.jpg|thumb|A display at Frankfurt Airport running a program under Windows XP that has crashed due to a Segmentation fault|memory read access violation

An Software application|application typically crashes when it performs an operation which is not allowed by the operating system. The operating system then triggers an exception handling|exception or Signal (computing)|signal in the application. Unix applications traditionally responded to the signal by Core dump|dumping core. Most Windows and Unix Graphical user interface|GUI applications respond by displaying a dialogue box (such as the one shown to the right)
with the option to attach a debugger if one is installed. Some applications attempt to recover from the error and continue running instead of exit (system call)|exiting.

Typical errors that result in application crashes include:
attempting to read or write memory that is not allocated for reading or writing by that application (segmentation fault) or x86 specific (general protection fault)
attempting to execute privileged or invalid instructions
attempting to perform I/O operations on computer hardware|hardware devices to which it does not have permission to access
passing invalid arguments to system calls
attempting to access other system resources to which the application does not have permission to access
attempting to execute machine instructions with bad arguments (depending on CPU architecture): Division by zero|divide by zero, operations on Denormal number|denorms or NaN values, memory access to Bus error|unaligned addresses, etc.

Web server crashes
The software running the web server behind a website may crash, rendering it inaccessible entirely or providing only an error message instead of normal content.

For example: if a site is using an SQL database (such as MySQL) for a script (such as PHP) and that SQL database server crashes, then PHP will display a connection error.

Operating system crashes
An operating system crash commonly occurs when a Exception handling#Exception handling in hardware|hardware exception occurs that cannot be Exception handling|handled. Operating system crashes can also occur when internal Sanity check|sanity-checking logic within the operating system detects that the operating system has lost its internal self-consistency.

Modern multi-tasking operating systems, such as Windows NT, Linux, and macOS usually remain unharmed when an application program crashes.

Security implications of crashes
Many software bugs which cause crashes are also Exploit (computer security)|exploitable for arbitrary code execution and other types of privilege escalation.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/magazine/cc163311.aspx |title=Analyze Crashes to Find Security Vulnerabilities in Your Apps |publisher=Msdn.microsoft.com |date=2007-04-26 |accessdate=2014-06-26}}<ref>{{cite web|url=http://www.squarefree.com/2006/11/01/memory-safety-bugs-in-c-code/ |title=Jesse
Ruderman » Memory safety bugs in C++ code |publisher=Squarefree.com |date=2006-11-01 |accessdate=2014-06-26}} For example, a stack buffer overflow can overwrite the return address of a subroutine with an invalid value, which will cause a segmentation fault when the subroutine returns. However, if an exploit overwrites the return address with a valid value, the code in that address will be executed.

See also
Blue Screen of Death
Crash-only software
Crash reporter
Crash to desktop
Data loss
Debugging
Guru Meditation
Kernel panic
Memory corruption
Reboot (computing)|Reboot
Safe mode
Segmentation fault
SystemRescueCD
Undefined behaviour

References
{{reflist}}

External links
{{commons category|Computer errors}}
[http://windows.microsoft.com/en-us/windows-vista/picking-up-the-pieces-after-a-computer-crash Picking Up The Pieces After A Computer Crash]
[http://www.scientificamerican.com/article.cfm?id=why-do-computers-crash Why do computers crash?]

{{DEFAULTSORT:Crash (Computing)}}
Category:Computer jargon
Category:Computer errors
Category:Software anomalies

